﻿using System;
using System.Data;
using Model.Entity;


namespace DAL
{
    public class UserDAL
    {
        private BaseDAL baseDal = null;
        private readonly static String GET_USER_SQL = "select u.*,ut.* from _User u inner join _UserType ut on u.userTypeId=ut.id";

        public UserDAL()
        {
            baseDal = new BaseDAL();
        }

        public virtual DataTable getT()
        {
            return baseDal.executeSql(GET_USER_SQL);
        }

        public virtual DataTable getT(int userId)
        {
            return baseDal.executeSql(GET_USER_SQL + " where u.id=@0", userId);
        }

        public virtual User get(int userId)
        {
            return (User)baseDal.get(typeof(User), userId);
        }
    }
}
